import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 预收款客户查询
export const saveAdvancesReceived = params => axios.post(`${SERVER.DMSCLOUD_FINANCE}/preReceiveMoney/save`, params);
// 预收款客户信息
export const findOwnerAmount = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/preReceiveMoney/findOwnerAmount`, { params });
// 预收款明细
export const findOwnerAmountDetail = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/preReceiveMoney/findOwnerAmountDetail`, { params });
// 预收款明细
export const exportOwnerExcel = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/preReceiveMoney/exportOwner`, { params, responseType: 'arraybuffer' });

// 预收款客户查询
export const prepayCustomer = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/finance/advancesReceived/prepayCustomer`, { params });
// 预收款导出
export const exportExcelData = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/finance/advancesReceived/prepayCustomer/export/excel`, { params, responseType: 'arraybuffer' });
// 预收款明细导出
export const exportOwnerAmountDetail = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/preReceiveMoney/exportOwnerAmountDetail`, { params, responseType: 'arraybuffer' });

// 预收款明细查询
export const queryPrePay = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/finance/advancesReceived/queryPrePay`, { params });
// 查询所有员工
export const getAllUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);
//获取所有经销商
export const getAllDealer = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerInfo/byAllTranslate`, { params });

// 售后收款（收银）
// 收银列表查询
export const getReceivedlist = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/receiveMoney/findReceiveMoney`, { params });
// 收款明细列表
export const getReceiptRecord = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/receiveMoney/queryReceiveDetail`, { params });
// 减免
export const reduction = params => axios.post(`${SERVER.DMSCLOUD_FINANCE}/receiveMoney/Derate`, params);
// 销账查询
export const getWriteOffList = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/receiveMoney/queryReceiveDetailByWriteOff`, { params });
// 销账保存
export const saveWriteOff = (id, params) => axios.post(`${SERVER.DMSCLOUD_FINANCE}/receiveMoney/WriteOff/${id}`, params);
// 获取预存金
export const getBalance = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/preReceiveMoney/queryPrePayByOwnerNo`, { params });
// 收款保存接口
export const gathering = params => axios.post(`${SERVER.DMSCLOUD_FINANCE}/receiveMoney/gathering`, params);
// 售后收款导出
export const exportReceiveMoney = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/receiveMoney/export/excel`, { params, responseType: 'arraybuffer' });
